package com.koron.css2.serviceManage.service;

import com.koron.css2.serviceManage.bean.TServicePageBean;
import com.koron.css2.serviceManage.mapper.TServicePageMapper;
import com.koron.css2.serviceManage.utils.CommonUtils;
import org.bson.types.ObjectId;
import org.koron.ebs.mybatis.SessionFactory;
import org.koron.ebs.mybatis.TaskAnnotation;
import org.springframework.stereotype.Service;

/**
 * 调用页面明细
 * 
 * @author 陈维杰
 *
 */
@Service
public class ServicePageService {
	/**
	 * 新增调用页面明细
	 * 
	 * @param sessionFactory
	 * @param tPageBean
	 * @return
	 */
	@TaskAnnotation("insPageToServices")
	public Integer insPageToServices(SessionFactory sessionFactory, TServicePageBean tPageBean) {
		Integer insPageToServices = 0;
		TServicePageBean check = null;
		TServicePageMapper pageMapper = sessionFactory.getMapper(TServicePageMapper.class);
		try {
			check = pageMapper.findServicePage(tPageBean);
		} catch (Exception e) {
		}
		if (check == null) {
			tPageBean.setPageId(new ObjectId().toHexString());
			tPageBean.setCreateTime(CommonUtils.getCurrentTime());
			pageMapper.insert(tPageBean);
		}
		return insPageToServices;
	}

}
